package com.alienlab.finder.domain;


import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.*;

import java.io.Serializable;
import java.util.Objects;

/**
 * A Relationship.
 */
@Entity
@Table(name = "relationship")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Relationship implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotNull
    @Column(name = "main_user_open_id", nullable = false)
    private String mainUserOpenId;

    @NotNull
    @Column(name = "second_user_open_id", nullable = false)
    private String secondUserOpenId;

    @Column(name = "relation")
    private String relation;

    @Column(name = "distance_size")
    private String distanceSize;

    @Column(name = "nickname")
    private String nickname;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMainUserOpenId() {
        return mainUserOpenId;
    }

    public Relationship mainUserOpenId(String mainUserOpenId) {
        this.mainUserOpenId = mainUserOpenId;
        return this;
    }

    public void setMainUserOpenId(String mainUserOpenId) {
        this.mainUserOpenId = mainUserOpenId;
    }

    public String getSecondUserOpenId() {
        return secondUserOpenId;
    }

    public Relationship secondUserOpenId(String secondUserOpenId) {
        this.secondUserOpenId = secondUserOpenId;
        return this;
    }

    public void setSecondUserOpenId(String secondUserOpenId) {
        this.secondUserOpenId = secondUserOpenId;
    }

    public String getRelation() {
        return relation;
    }

    public Relationship relation(String relation) {
        this.relation = relation;
        return this;
    }

    public void setRelation(String relation) {
        this.relation = relation;
    }

    public String getDistanceSize() {
        return distanceSize;
    }

    public Relationship distanceSize(String distanceSize) {
        this.distanceSize = distanceSize;
        return this;
    }

    public void setDistanceSize(String distanceSize) {
        this.distanceSize = distanceSize;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Relationship that = (Relationship) o;
        return Objects.equals(id, that.id) &&
            Objects.equals(mainUserOpenId, that.mainUserOpenId) &&
            Objects.equals(secondUserOpenId, that.secondUserOpenId) &&
            Objects.equals(relation, that.relation) &&
            Objects.equals(distanceSize, that.distanceSize) &&
            Objects.equals(nickname, that.nickname);
    }

    @Override
    public int hashCode() {

        return Objects.hash(id, mainUserOpenId, secondUserOpenId, relation, distanceSize, nickname);
    }

    @Override
    public String toString() {
        return "Relationship{" +
            "id=" + id +
            ", mainUserOpenId='" + mainUserOpenId + '\'' +
            ", secondUserOpenId='" + secondUserOpenId + '\'' +
            ", relation='" + relation + '\'' +
            ", distanceSize='" + distanceSize + '\'' +
            ", nickname='" + nickname + '\'' +
            '}';
    }
}
